package com.jrzh.mvc.search.sys;

import org.apache.commons.lang.StringUtils;

import com.jrzh.framework.base.search.BaseSearch;
import com.jrzh.framework.searchutils.Criteria;
import com.jrzh.framework.searchutils.Restrictions;

public class UserSearch extends BaseSearch{

	/**
	 * 
	 */
	private static final long serialVersionUID = -3527535991377306405L;
	
	private String likeName;
	
	private String likeCode;
	
	private String equalCode;
	
	private String likeTel;
	
	private Integer equalSex;
	
	private Integer eqStatus;
	
	private Object[] noInIds;
	
	private Object[] inIds;

	@Override
	public void setCriterias(Criteria<?> criterias) {
		if(StringUtils.isNotBlank(likeCode)){
			criterias.add(Restrictions.like("code", "%" + likeCode + "%"));
		}
		if(StringUtils.isNotBlank(likeName)){
			criterias.add(Restrictions.like("name", "%" + likeName + "%"));
		}
		if(StringUtils.isNotBlank(likeTel)){
			criterias.add(Restrictions.like("tel", "%" + likeTel + "%"));
		}
		if(StringUtils.isNotBlank(equalCode)){
			criterias.add(Restrictions.eq("code", equalCode));
		}
		if(null != equalSex){
			criterias.add(Restrictions.eq("sex", equalSex));
		}
		if(null != eqStatus){
			criterias.add(Restrictions.eq("status", eqStatus));
		}
		if(null != noInIds&&noInIds.length>0){
			criterias.add(Restrictions.notIn("id", noInIds));
		}
		if(null != inIds&&inIds.length>0){
			criterias.add(Restrictions.in("id", inIds));
		}
	}

	public String getLikeName() {
		return likeName;
	}

	public void setLikeName(String likeName) {
		this.likeName = likeName;
	}

	public String getLikeCode() {
		return likeCode;
	}

	public void setLikeCode(String likeCode) {
		this.likeCode = likeCode;
	}

	public String getLikeTel() {
		return likeTel;
	}

	public void setLikeTel(String likeTel) {
		this.likeTel = likeTel;
	}

	public String getEqualCode() {
		return equalCode;
	}

	public void setEqualCode(String equalCode) {
		this.equalCode = equalCode;
	}

	public Integer getEqualSex() {
		return equalSex;
	}

	public void setEqualSex(Integer equalSex) {
		this.equalSex = equalSex;
	}

	public Integer getEqStatus() {
		return eqStatus;
	}

	public void setEqStatus(Integer eqStatus) {
		this.eqStatus = eqStatus;
	}

	public Object[] getNoInIds() {
		return noInIds;
	}

	public void setNoInIds(Object[] noInIds) {
		this.noInIds = noInIds;
	}

	public Object[] getInIds() {
		return inIds;
	}

	public void setInIds(Object[] inIds) {
		this.inIds = inIds;
	}
}
